package o;

import android.view.View;
import android.view.ViewParent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;

public class hr {
    private final View ˊ;
    private ViewParent ˋ;
    private int[] ˎ;
    private ViewParent ˏ;
    private boolean ॱ;

    public hr(@NonNull View view) {
        this.ˊ = view;
    }

    public void ˊ(boolean z) {
        if (this.ॱ) {
            ViewCompat.ʽॱ(this.ˊ);
        }
        this.ॱ = z;
    }

    public boolean ˏ() {
        return this.ॱ;
    }

    public boolean ˎ() {
        return ॱ(0);
    }

    public boolean ॱ(int i) {
        return ˋ(i) != null;
    }

    public boolean ˊ(int i) {
        return ˊ(i, 0);
    }

    public boolean ˊ(int i, int i2) {
        if (ॱ(i2)) {
            return true;
        }
        if (ˏ()) {
            View view = this.ˊ;
            for (ViewParent parent = this.ˊ.getParent(); parent != null; parent = parent.getParent()) {
                if (ie.ˏ(parent, view, this.ˊ, i, i2)) {
                    ˏ(i2, parent);
                    ie.ॱ(parent, view, this.ˊ, i, i2);
                    return true;
                }
                if (parent instanceof View) {
                    view = (View) parent;
                }
            }
        }
        return false;
    }

    public void ॱ() {
        ˎ(0);
    }

    public void ˎ(int i) {
        ViewParent ˋ = ˋ(i);
        if (ˋ != null) {
            ie.ˎ(ˋ, this.ˊ, i);
            ˏ(i, null);
        }
    }

    public boolean ˊ(int i, int i2, int i3, int i4, @Nullable int[] iArr) {
        return ॱ(i, i2, i3, i4, iArr, 0, null);
    }

    public boolean ˎ(int i, int i2, int i3, int i4, @Nullable int[] iArr, int i5) {
        return ॱ(i, i2, i3, i4, iArr, i5, null);
    }

    public void ˋ(int i, int i2, int i3, int i4, @Nullable int[] iArr, int i5, @Nullable int[] iArr2) {
        ॱ(i, i2, i3, i4, iArr, i5, iArr2);
    }

    private boolean ॱ(int i, int i2, int i3, int i4, @Nullable int[] iArr, int i5, @Nullable int[] iArr2) {
        if (ˏ()) {
            ViewParent ˋ = ˋ(i5);
            if (ˋ == null) {
                return false;
            }
            if (i != 0 || i2 != 0 || i3 != 0 || i4 != 0) {
                int i6;
                int i7;
                int[] ˋ2;
                if (iArr != null) {
                    this.ˊ.getLocationInWindow(iArr);
                    int i8 = iArr[0];
                    i6 = iArr[1];
                    i7 = i8;
                } else {
                    i6 = 0;
                    i7 = 0;
                }
                if (iArr2 == null) {
                    ˋ2 = ˋ();
                    ˋ2[0] = 0;
                    ˋ2[1] = 0;
                } else {
                    ˋ2 = iArr2;
                }
                ie.ˎ(ˋ, this.ˊ, i, i2, i3, i4, i5, ˋ2);
                if (iArr != null) {
                    this.ˊ.getLocationInWindow(iArr);
                    iArr[0] = iArr[0] - i7;
                    iArr[1] = iArr[1] - i6;
                }
                return true;
            } else if (iArr != null) {
                iArr[0] = 0;
                iArr[1] = 0;
            }
        }
        return false;
    }

    public boolean ˎ(int i, int i2, @Nullable int[] iArr, @Nullable int[] iArr2) {
        return ॱ(i, i2, iArr, iArr2, 0);
    }

    public boolean ॱ(int i, int i2, @Nullable int[] iArr, @Nullable int[] iArr2, int i3) {
        if (!ˏ()) {
            return false;
        }
        ViewParent ˋ = ˋ(i3);
        if (ˋ == null) {
            return false;
        }
        if (i != 0 || i2 != 0) {
            int i4;
            int i5;
            int[] ˋ2;
            if (iArr2 != null) {
                this.ˊ.getLocationInWindow(iArr2);
                int i6 = iArr2[0];
                i4 = iArr2[1];
                i5 = i6;
            } else {
                i4 = 0;
                i5 = 0;
            }
            if (iArr == null) {
                ˋ2 = ˋ();
            } else {
                ˋ2 = iArr;
            }
            ˋ2[0] = 0;
            ˋ2[1] = 0;
            ie.ˋ(ˋ, this.ˊ, i, i2, ˋ2, i3);
            if (iArr2 != null) {
                this.ˊ.getLocationInWindow(iArr2);
                iArr2[0] = iArr2[0] - i5;
                iArr2[1] = iArr2[1] - i4;
            }
            boolean z = (ˋ2[0] == 0 && ˋ2[1] == 0) ? false : true;
            return z;
        } else if (iArr2 == null) {
            return false;
        } else {
            iArr2[0] = 0;
            iArr2[1] = 0;
            return false;
        }
    }

    public boolean ˊ(float f, float f2, boolean z) {
        if (!ˏ()) {
            return false;
        }
        ViewParent ˋ = ˋ(0);
        if (ˋ != null) {
            return ie.ˎ(ˋ, this.ˊ, f, f2, z);
        }
        return false;
    }

    public boolean ˎ(float f, float f2) {
        if (!ˏ()) {
            return false;
        }
        ViewParent ˋ = ˋ(0);
        if (ˋ != null) {
            return ie.ˎ(ˋ, this.ˊ, f, f2);
        }
        return false;
    }

    private ViewParent ˋ(int i) {
        switch (i) {
            case 0:
                return this.ˏ;
            case 1:
                return this.ˋ;
            default:
                return null;
        }
    }

    private void ˏ(int i, ViewParent viewParent) {
        switch (i) {
            case 0:
                this.ˏ = viewParent;
                return;
            case 1:
                this.ˋ = viewParent;
                return;
            default:
                return;
        }
    }

    private int[] ˋ() {
        if (this.ˎ == null) {
            this.ˎ = new int[2];
        }
        return this.ˎ;
    }
}
